<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台欢迎页</title>

    <link rel="stylesheet" href="__PUBLIC__css/bootstrap.css" />
    <link rel="stylesheet" href="__PUBLIC__css/reset.css" />
    <link rel="stylesheet" href="__PUBLIC__css/content.css" />
    <script src="__PUBLIC__js/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="__PUBLIC__js/bootstrap.min.js" type="text/javascript"></script>
    <style>
        td{
            vertical-align :middle;
        }
        body{
            background-color: #EFF3F6;
        }
        .wf{
            color: white;
        }
        .fl{
            float: right;
            /* margin-right: 14px; */
            /* margin-bottom: -4px; */
            margin: -4px 15px;
            /* padding-bottom: 21px; */
        }
    </style>
    <script type="text/javascript">
        function confirmd() {
            var msg = "您真的确定要删除吗?";
            if(confirm(msg)==true){
                return true;
            }else{
                return false;
            }
        }

        function addpos(good_id, pos_id) {
            $.ajax({
                type: "POST",
                url: "{:url('admin/Position/goods2pos')}",
                dataType: 'html',
                data: {
                    goods_id: good_id,
                    pos_id: pos_id
                },
                success: function(data){
                    if (1 == data) {
                        alert('添加成功!');
                        window.location.reload()
                    }
                },
                error: function(){
                    alert('wrong!')
                }
            })
        }
    </script>
</head>
<body marginwidth="0" marginheight="0">
<div class="container">
    <div class="public-nav">您当前的位置：<a href="{:url('admin/Goods/adminIndex')}">管理首页</a>><a href="{:url('admin/Goods/goodsList')}">商品管理</a></div>
    <div class="public-content">
        <div class="public-content-header">
            <h3>查看商品列表<a href="{:url('admin/Goods/goodsAdd')}"><button type="button" class="btn btn-info btn-xs fl">新增商品数据</button></a></h3>
        </div>
        <div class="public-content-cont">
            <table class="public-cont-table">
                <tr>
                    <!--<th style="width:5%">选择</th>-->
                    <th style="width:5%;background-color: #c9dae4">ID</th>
                    <th style="width:10%;background-color: #c9dae4">商品名称</th>
                    <th style="width:20%;background-color: #c9dae4">商品简介</th>
                    <th style="width:5%;background-color: #c9dae4">商品原现价</th>
                    <th style="width:10%;background-color: #c9dae4">链接</th>
                    <th style="width:15%;background-color: #c9dae4">图片</th>
                    <th style="width:7%;background-color: #c9dae4">更新时间</th>
                    <th style="width:5%;background-color: #c9dae4">有效期</th>
                    <th style="width:6%;background-color: #c9dae4">点击量</th>
                    <th style="width:20%;background-color: #c9dae4">操作</th>
                </tr>
                {volist name="list" id="goods"}
                <tr>
                    <!--<td><input type="checkbox"></td>-->
                    <td>{$goods.Id}</td>
                    <td>{$goods.title}</td>
                    <td>{$goods.description}</td>
                    <td>原价:{$goods.old_price}<br>现价:{$goods.new_price}</td>
                    <td><span style="color:#6bc095">商品链接:<hr><a href="{$goods.url}">{$goods.url}</a><hr>优惠券链接:<hr><a href="{$goods.ticket_url}">{$goods.ticket_url}</a></span></td>
                    <td><img class="thumb" src="{$goods.pictrue_url}" /></td>
                    <td>{$goods.update_time}</td>
                    <td>2016-6-3</td>
                    <td>商品点击量:<i style="color: red">{$goods.goods_hit}</i><br>优惠券点击:<i style="color: red">{$goods.ticket_hit}</i></td>
                    <td>
                        <div class="btn-group btn-group-justified ">
                            <div class="btn-group">
                                <a href="#" class="btn btn-info  btn-xs dropdown-toggle " data-toggle="dropdown" aria-expanded="false">推荐至<span class="caret"></span>
                                </a>
                                <ul class="dropdown-menu" role="menu">
                                    <!--写推荐位的循环-->
                                    {volist name="pos_list" id="pos"}
                                    <li><a href="#" onclick='return addpos("{$goods.Id}","{$pos.pos_id}")'>{$pos.pos_name}</a></li>
                                    {/volist}
                                    <!--循环止-->
                                    <li class="divider"></li>
                                    <li><a href="{:url('admin/Position/positionAdd')}">新建推荐位</a></li>
                                </ul>
                            </div>
                            <a href="{:url('admin/Goods/edit'),'?id='.$goods.Id}" class="btn btn-success btn-xs " role="button" target="content">修改</a>
                            <a href="{:url('admin/Goods/del'),'?id='.$goods.Id}" class="btn btn-danger btn-xs " role="button" onclick="return confirmd()" target="content">删除</a>
                        </div>
                        <hr>
                        <div>
                            目前推荐位:{$goods.pos_name}
                        </div>
                    </td>

                </tr>
                {/volist}
                共<span style="color: red">（{$list->total()}）</span>条商品信息
            </table>
            <div class="page">
                {$list->render()}
            </div>
        </div>
    </div>
</div>
</body>
</html>